<template>
  <div class="container-content programme">
    <el-row>
      <el-col :span="24">
        <h3 class="panel-title">编辑方案</h3>
      </el-col>
    </el-row>
    <el-card shadow="never">
      <el-form
        ref="formRef"
        :model="formObject"
        label-width="100px"
        label-position="left"
        class="programme-form"
      >
        <el-form-item label="组织名称">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="部门名称">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="项目名称">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="项目编码">
          <el-input></el-input>
        </el-form-item>
        <el-form-item label="客户Id">
          <el-input v-model="formObject.customerId"></el-input>
        </el-form-item>
        <el-form-item label="勘测报告Id">
          <el-input v-model="formObject.surveyReportId"></el-input>
        </el-form-item>
        <el-form-item label="方案名称">
          <el-input v-model="formObject.programmeName"></el-input>
        </el-form-item>
        <el-form-item label="方案出具人">
          <el-input v-model="formObject.programmeUserId"></el-input>
        </el-form-item>
        <el-form-item label="方案内容">
          <el-input v-model="formObject.programmeContent"></el-input>
        </el-form-item>
        <el-form-item label="方案出具日期">
          <el-date-picker
            v-model="formObject.programmeTime"
            type="date"
            placeholder="选择日期"
            style="width: 100%"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="客户反馈">
          <el-input v-model="formObject.customerFeedback"></el-input>
        </el-form-item>
        <el-form-item label="概算来源">
          <el-radio v-model="formObject.estimateSource" :label="1" border
            >己方概算</el-radio
          >
          <el-radio v-model="formObject.estimateSource" :label="2" border
            >客户提供</el-radio
          >
        </el-form-item>
        <el-form-item label="备注">
          <el-input v-model="formObject.remarks" type="textarea"></el-input>
        </el-form-item>
        <el-form-item label-width="0px">
          <el-button type="primary" @click="onSubmit">保存</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>
<script>
import {
  addProList,
  getDetailProList,
  editProList,
} from "@/api/system/survey/";
export default {
  data() {
    return {
      formObject: {
        changeTime: "",
        createBy: "",
        createTime: "",
        customerFeedback: "",
        customerId: "",
        estimateSource: 0,
        id: "",

        money: "",
        params: {},
        programmeContent: "",
        programmeName: "",
        programmeTime: "",
        programmeUserId: "",
        remark: "",
        remarks: "",
        searchValue: "",
        surveyReportId: "",
        updateBy: "",
        updateTime: "",
        userId: "",
      },
    };
  },
  methods: {
    onSubmit() {
      editProList(this.formObject).then((res) => {
        if (res.code === 200) {
          this.$message({
            message: "修改成功！",
            type: "success",
          });
          this.$router.push({ path: "/Survey/Programme" });
        }
      });
    },

    getData(id) {
      getDetailProList(id).then((res) => {
        if (res.code === 200) {
          let data = res.data;
          Object.keys(this.formObject).forEach((key) => {
            this.formObject[key] = data[key];
          });
        }
      });
    },
  },
  created() {
    this.getData(this.$route.query.id);
  },
};
</script>
<style lang="scss" scoped></style>
